package Google_Code_Jam;
import java.util.Scanner;

/*
 * @Author Josh Lear
 * @Date 4/12/2014
 * @Problem Optimize a cookie clicker scenario with only cookie clicker farms
 * round 1
 */
public class Google_Code_Jam_B {
    public static void main (String[] args) {
        Scanner sc = new Scanner(System.in);
        int cases = sc.nextInt();
        for (int i = 0; i < cases; i++) {
            double farmCost = sc.nextDouble();
            double farmValue = sc.nextDouble();
            double goal = sc.nextDouble();
            double repayTime = farmCost / farmValue;
            double rate = 2.0;
            double goalTime = goal / rate;
            double time = 0;
            boolean weirdo = false;
            // if we can repay the last farm before reaching our goal
            // buy the last farm
            while (repayTime < goalTime) {
                weirdo = true;
                time += farmCost / rate;
                rate += farmValue;
                goalTime = goal / rate;
            }
            // get rid of the prior farm because it's actually better to just
            // let it ride
            // to the goal.
            if (weirdo) {
                rate -= farmValue;
                goalTime = goal / rate;
                time -= farmCost / rate;
            }
            // add the time from 0 to the goal with max farms.
            time += goal / rate;
            System.out.printf("Case #%d: %.7f\n", (i + 1), time);
        }
        sc.close();
    }
}
